package fr.afcepf.vod.metier;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.inject.Named;

import fr.afcepf.vod.entities.Description;
import fr.afcepf.vod.entities.Tag;
import fr.afcepf.vod.entities.Valeurstring;
import fr.afcepf.vod.entities.Video;

public class GestionTagBidon implements IGestionTag {
	
	
	
	@Override
	public List<Tag> getListeTags() {
		Date dateCreation = new Date(new Date().getTime() - 86400000);
		int nbOccurencesRecherche1 = 17;
		int nbOccurencesRecherche2 = 60;
		Description description = new Description();
		description.setIntitule("Film");
		Valeurstring valeurString = new Valeurstring();
		valeurString.setLibelle("Sergio Leone");
		Tag tag1 = new Tag();
		tag1.setDateCreation(dateCreation);
		tag1.setNbOccurencesRecherche(nbOccurencesRecherche1);
		tag1.setDescription(description);
		Tag tag2 = new Tag();
		tag2.setDateCreation(dateCreation);
		tag2.setNbOccurencesRecherche(nbOccurencesRecherche2);
		tag2.setValeurstring(valeurString);
		List<Tag> resultat = new ArrayList<Tag>();
		resultat.add(tag1);
		resultat.add(tag2);
		return resultat;
	}

	@Override
	public String getLabel(Tag t) {
		if(t.getDescription() != null){
			return t.getDescription().getIntitule();
		}
		if(t.getValeurstring().getLibelle() != null){
			return t.getValeurstring().getLibelle();
		}
		return null;
	}

	@Override
	public int getStrength(Tag t) {
		int maxOccurences = 77;
		int occurences = t.getNbOccurencesRecherche();
		return (int) (0.5 + 5 * occurences / maxOccurences);
	}

	@Override
	public List<Video> getVideosByTagMessage(String message) {
		// TODO Auto-generated method stub
		return null;
	}

}
